package com.sh.controller;

import com.sh.dto.LoginObject;
import com.sh.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sh.dto.ResultDto;

import javax.annotation.Resource;

@RestController
@Api(tags = "登录接口")
public class LoginController {

    @Resource
    private LoginService loginService;
    @ApiOperation(value = "登录方法")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "userName", value = "登录号", required = true),
            @ApiImplicitParam(paramType = "query", name = "password", value = "登录密码", required = true),
            @ApiImplicitParam(paramType = "query", name = "role", value = "登录角色", required = true)
    })
    @PostMapping("/login")
    public ResultDto login(@RequestBody LoginObject loginObject){
        return loginService.login(loginObject);
    }
}
